//
//  GameController.m
//  jumpingfrog
//
//  Created by Tri Vo on 8/16/13.
//  Copyright (c) 2013 Tri Vo. All rights reserved.
//

#import "GameController.h"
#import "GeneralDef.h"

@implementation GameController

+ (void) popScene:(CCScene *)scene {
    [[CCDirector sharedDirector] popSceneWithTransition:[CCTransitionSlideInL class] duration:0.3f];
}

+ (void) pushScene:(CCScene *)scene {
    [[CCDirector sharedDirector] pushScene:scene];
}

+ (void) replaceScene:(CCScene *)scene {
    [[CCDirector sharedDirector] replaceScene:[CCTransitionFade transitionWithDuration:0.3f scene:scene]];
}

+ (CGSize) getWinSize {
    CGSize winSize = [[CCDirector sharedDirector] winSize];
    return winSize;
}

+ (BOOL) getSoundState {
    return [[NSUserDefaults standardUserDefaults] boolForKey:SET_SOUND];
}

+ (void) setSoundState:(BOOL)bVal {
    [[NSUserDefaults standardUserDefaults] setBool:bVal forKey:SET_SOUND];
    [[NSUserDefaults standardUserDefaults] synchronize];
}

+ (BOOL) getMusicState {
    return [[NSUserDefaults standardUserDefaults] boolForKey:SET_MUSIC];
}

+ (void) setMusicState:(BOOL)bVal {
    [[NSUserDefaults standardUserDefaults] setBool:bVal forKey:SET_MUSIC];
    [[NSUserDefaults standardUserDefaults] synchronize];
}

+ (void) log:(NSString *)logStr {
    NSLog(@"\n\n%@\n", logStr);
}

+ (int)getFrogLife {
    return [[NSUserDefaults standardUserDefaults] integerForKey:SET_FROG_LIFE];
}

+ (void)setFrogLife:(int)life {
    [[NSUserDefaults standardUserDefaults] setInteger:life forKey:SET_FROG_LIFE];
    [[NSUserDefaults standardUserDefaults] synchronize];
}

@end
